﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ProcessManagerPlugin.Common;
using ScreenMonitor.Common;

namespace ProcessManagerPlugin.Client
{
    public partial class ProcessManagerPlugin
    {
        private object lock1 = new object();
        public void OperateGetList()
        {
            lock(lock1)
            {
                MemorySendableList<ProcessInfoObj> lst = new MemorySendableList<ProcessInfoObj>();
                foreach (Process pro in Process.GetProcesses())
                {
                    ProcessInfoObj obj = new ProcessInfoObj();
                    obj.ProcessName = pro.ProcessName;
                    obj.Id = pro.Id;
                    lst.Add(obj);
                }
                byte[] Data = lst.ToByte();
                ScreenMonitor.CommandObjects.TcpCommandCenter.SendCommandWithData(Common.CommandType.PostProcessList,Data, ScreenMonitor.ClientLib.ServerObject.ClientBase);
            }
        }
    }
}
